{extend name='Common/index' /} {block name='content'}
<section class="content">
  <div class="row">
    <div class="col-xs-12">
      <div class="box">
        <div class="box-body">
          <table id="tableData" class="table table-bordered table-hover">
            <thead>
              <tr>
                <th>ID</th>
                <th>工单编号</th>
                <th>工单标题</th>
                <th>工单类型</th>
                <th>工单状态</th>
                <th>提交时间</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
              {if !empty($list)} {foreach name="list" item="v"}
              <tr data-id="{$v.id}">
                <td>{$v.id}</td>
                <td>{$v.num}</td>
                <td>{$v.title}</td>
                <td>{$v.type}</td>
                <td>{$v.tStatus}</td>
                <td>{$v.create_time}</td>
                <td>
                  {if !$v.replierid}
                  <a class="mr-3" href="javascript:;" onclick="join('{$v.id}')">接入</a>
                  {/if}
                  <a href="{:url('admin/Ticket/details',['id'=>$v['id']])}">查看</a>
                </td>
              </tr>
              {/foreach} {/if}
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
</section>
{/block} {block name='js'}
<script>
  function join(id) {
    console.log(id)
    if (confirm('确定要接入该工单吗?')) {
      ajax("{:url('admin/Ticket/join')}?id="+id).then((e) => {
        window.location.href = "{:url('admin/Ticket/details')}?id=" + id;
      })
    }
  }

  $('#tableData').DataTable({
    'paging': true,
    'lengthChange': false,
    'searching': false,
    'ordering': true,
    'info': true,
    'autoWidth': false,
    'stateSave': true,
    'deferRender': true,
    'processing': true,
  });
</script>
{/block}